package com.example.aipdefficiency.controller;

import com.example.aipdefficiency.common.ApiResponse;
import com.example.aipdefficiency.dto.UserRegisterRequest;
import com.example.aipdefficiency.dto.UserRegisterResponse;
import com.example.aipdefficiency.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

@Slf4j
@RestController
@RequestMapping("/v1/user")
@Tag(name = "用户管理", description = "用户相关接口")
public class UserController {
    
    @Autowired
    private UserService userService;
    
    @PostMapping("/register")
    @Operation(summary = "用户注册", description = "用户注册接口，支持手机号注册，创建用户账户")
    public ApiResponse<UserRegisterResponse> register(@Valid @RequestBody UserRegisterRequest request) {
        log.info("用户注册请求：{}", request.getMobile());
        UserRegisterResponse response = userService.register(request);
        return ApiResponse.success("注册成功", response);
    }
} 